<?php

// use \DB;
use Illuminate\Database\Seeder;

class AdminSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::table('users')->insert([
            'id'        => 1000,
            'name'      => 'admin',
            'email'     => 'a',
            'is_active' => 1,
            'password'  => bcrypt('123123')
            ]);

        // 初始化角色组
        Artisan::call('db:seed', ['--class' => 'RoleSeeder']);

        // 添加管理员到拥有者角色
        DB::table('role_user')->insert([
            'user_id' => 1000,
            'role_id' => 101,
            ]);
    }
}
